package translinkApp.views.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;

public abstract class LachDialog<D> extends Dialog {

	private final LachDialogArguments args;
	private OnDismissListener secondaryDismiss = null;

	public LachDialog(final Context context, int layoutResID, LachDialogArguments args, D data) {
		super(context);
		this.args = args;

		if (layoutResID != -1)
			this.setContentView(layoutResID);

	}

	public LachDialogArguments getArgs() {
		return args;
	}

	public abstract D getDialogData();

	public abstract void loadDialogData(D data);

	@Override
	public void dismiss() {
		super.dismiss();
		if (secondaryDismiss != null) {
			secondaryDismiss.onDismiss(this);
		}
	}

	public void setSecondaryDismissListener(OnDismissListener secondaryDismiss) {
		this.secondaryDismiss = secondaryDismiss;
	}

	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		// Do nothing.
	}

}
